$._ps_ = {
  ping: function () {
    return 'success'
  },
  open: function (filePath) {
    return open(new File(filePath))
  },
  getActiveDocument: function () {
    var doc = app.activeDocument
    return {
      name: doc.name,
      fullName: doc.fullName,
      path: doc.path,
      saved: doc.isavedd,
    }
  },
  saveAsPNG: function (filePath, options) {
    var saveFile = new File(filePath);
    var pngSaveOptions = new PNGSaveOptions();
    pngSaveOptions.interlaced = options.interlaced || true;
    pngSaveOptions.compression = options.compression || 0
    app.activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
  },
  saveAsJPEG: function (filePath, options) {
    var saveFile = new File(filePath);
    var jpegSaveOptions = new JPEGSaveOptions();
    jpegSaveOptions.embedcolorProfile = options.embedcolorProfile || false;
    jpegSaveOptions.formatOptions = options.formatOptions || FormatOptions.STANDARDBASELINE
    jpegSaveOptions.quality = options.quality || 3
    jpegSaveOptions.matte = options.matte || MatteType.WHITE
    if (jpegSaveOptions.formatOptions === FormatOptions.PROGRESSIVE) {
      jpegSaveOptions.scans = options.scans || 3
    }
    app.activeDocument.saveAs(saveFile, jpegSaveOptions, true, Extension.LOWERCASE);
  }
}